#include "ThreadPool.hpp"
#include "Task.hpp"

int main()
{
    ThreadPool<task>* tp=new ThreadPool<task>(5);//new出来一个线程池，其内有5个线程

    tp->Start();
    srand(time(nullptr)^getpid());
    while(true)
    {
        //1.构建任务
        int x=rand()%10+1;
        usleep(10);
        int y=rand()%10;
        char opr=oprs[rand()%oprs.size()];

        task t(x,y,opr);

        tp->Push(t);
        //2.交给线程池处理
        cout<<"main thread make task:"<<t.GetTask()<<endl;
        usleep(1000);
    }


    return 0;
}